home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / timidsrc.zip / instrum.h < prev    next >
C/C++ Source or Header  |  1996-05-20  |  2KB  |  85 lines

  1. /*
  2.  
  3.     TiMidity -- Experimental MIDI to WAVE converter
  4.     Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20.    instrum.h
  21.  
  22.    */
  23.  
  24. typedef struct {
  25.   int32
  26.     loop_start, loop_end, data_length,
  27.     sample_rate, low_freq, high_freq, root_freq;
  28.   int32
  29.     envelope_rate[6], envelope_offset[6];
  30.   float
  31.     volume;
  32.   sample_t *data;
  33.   int32 
  34.     tremolo_sweep_increment, tremolo_phase_increment, 
  35.     vibrato_sweep_increment, vibrato_control_ratio;
  36.   uint8
  37.     tremolo_depth, vibrato_depth,
  38.     modes;
  39.   int8
  40.     panning, note_to_use;
  41. } Sample;
  42.  
  43. /* Bits in modes: */
  44. #define MODES_16BIT    (1<<0)
  45. #define MODES_UNSIGNED    (1<<1)
  46. #define MODES_LOOPING    (1<<2)
  47. #define MODES_PINGPONG    (1<<3)
  48. #define MODES_REVERSE    (1<<4)
  49. #define MODES_SUSTAIN    (1<<5)
  50. #define MODES_ENVELOPE    (1<<6)
  51.  
  52. typedef struct {
  53.   int samples;
  54.   Sample *sample;
  55. } Instrument;
  56.  
  57. typedef struct {
  58.   char *name;
  59.   Instrument *instrument;
  60.   int note, amp, pan, strip_loop, strip_envelope, strip_tail;
  61. } ToneBankElement;
  62.  
  63. /* A hack to delay instrument loading until after reading the
  64.    entire MIDI file. */
  65. #define MAGIC_LOAD_INSTRUMENT ((Instrument *)(-1))
  66.  
  67. typedef struct {
  68.   ToneBankElement tone[128];
  69. } ToneBank;
  70.  
  71. extern ToneBank *tonebank[], *drumset[];
  72.  
  73. extern Instrument *default_instrument;
  74. extern int default_program;
  75. extern int antialiasing_allowed;
  76. extern int fast_decay;
  77. extern int free_instruments_afterwards;
  78.  
  79. #define SPECIAL_PROGRAM -1
  80.  
  81. extern int load_missing_instruments(void);
  82. extern void free_instruments(void);
  83. extern int set_default_instrument(char *name);
  84.  
  85.